home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 2
/
Atari Mega Archive CD - Volume 2.iso
/
minix
/
up1510b.tgz
/
up1510b
/
src
/
fs
/
super.c.D
< prev
next >
Wrap
Text File
|
1990-07-25
|
7KB
|
195 lines
*** /tmp/,RCSt1022253 Wed Jul 25 13:49:04 1990
--- super.c Mon Jul 23 11:34:26 1990
***************
*** 15,23 ****
*/
! #include "../h/const.h"
! #include "../h/type.h"
! #include "../h/error.h"
! #include "const.h"
! #include "type.h"
#include "buf.h"
#include "inode.h"
--- 15,20 ----
*/
! #include "fs.h"
! #include <minix/boot.h>
#include "buf.h"
#include "inode.h"
***************
*** 31,35 ****
*===========================================================================*/
PUBLIC int load_bit_maps(dev)
! dev_nr dev; /* which device? */
{
/* Load the bit map for some device into the cache and set up superblock. */
--- 28,32 ----
*===========================================================================*/
PUBLIC int load_bit_maps(dev)
! dev_t dev; /* which device? */
{
/* Load the bit map for some device into the cache and set up superblock. */
***************
*** 38,43 ****
register struct super_block *sp;
block_nr zbase;
- extern struct buf *get_block();
- extern struct super_block *get_super();
sp = get_super(dev); /* get the superblock pointer */
--- 35,38 ----
***************
*** 59,63 ****
sp->s_imap[0]->b_int[0] |= 3; /* inodes 0, 1 busy */
sp->s_zmap[0]->b_int[0] |= 1; /* zone 0 busy */
- bufs_in_use += sp->s_imap_blocks + sp->s_zmap_blocks;
return(OK);
}
--- 54,57 ----
***************
*** 68,73 ****
* unload_bit_maps *
*===========================================================================*/
! PUBLIC unload_bit_maps(dev)
! dev_nr dev; /* which device is being unmounted? */
{
/* Unload the bit maps so a device can be unmounted. */
--- 62,67 ----
* unload_bit_maps *
*===========================================================================*/
! PUBLIC int unload_bit_maps(dev)
! dev_t dev; /* which device is being unmounted? */
{
/* Unload the bit maps so a device can be unmounted. */
***************
*** 78,82 ****
sp = get_super(dev); /* get the superblock pointer */
- bufs_in_use -= sp->s_imap_blocks + sp->s_zmap_blocks;
for (i = 0; i < sp->s_imap_blocks; i++) put_block(sp->s_imap[i], I_MAP_BLOCK);
for (i = 0; i < sp->s_zmap_blocks; i++) put_block(sp->s_zmap[i], ZMAP_BLOCK);
--- 72,75 ----
***************
*** 147,151 ****
* free_bit *
*===========================================================================*/
! PUBLIC free_bit(map_ptr, bit_returned)
struct buf *map_ptr[]; /* pointer to array of bit block pointers */
bit_nr bit_returned; /* number of bit to insert into the map */
--- 140,144 ----
* free_bit *
*===========================================================================*/
! PUBLIC void free_bit(map_ptr, bit_returned)
struct buf *map_ptr[]; /* pointer to array of bit block pointers */
bit_nr bit_returned; /* number of bit to insert into the map */
***************
*** 162,167 ****
bp = map_ptr[b];
if (bp == NIL_BUF) return;
! if (((bp->b_int[w] >> bit)& 1)== 0)
! panic("freeing unused block or inode--check file sys",(int)bit_returned);
bp->b_int[w] &= ~(1 << bit); /* turn the bit off */
bp->b_dirt = DIRTY;
--- 155,162 ----
bp = map_ptr[b];
if (bp == NIL_BUF) return;
! if (((bp->b_int[w] >> bit)& 1)== 0) {
! printf("FS freeing unused block of inode. bit = %d\n",bit_returned); /*DEBUG*/
! /* panic("freeing unused block or inode--check file sys",(int)bit_returned);*/
! }
bp->b_int[w] &= ~(1 << bit); /* turn the bit off */
bp->b_dirt = DIRTY;
***************
*** 173,177 ****
*===========================================================================*/
PUBLIC struct super_block *get_super(dev)
! dev_nr dev; /* device number whose super_block is sought */
{
/* Search the superblock table for this device. It is supposed to be there. */
--- 168,172 ----
*===========================================================================*/
PUBLIC struct super_block *get_super(dev)
! dev_t dev; /* device number whose super_block is sought */
{
/* Search the superblock table for this device. It is supposed to be there. */
***************
*** 196,202 ****
register struct super_block *sp;
! register dev_nr dev;
! dev = (dev_nr) rip->i_zone[0];
if (dev == ROOT_DEV) return(TRUE); /* inode is on root file system */
--- 191,197 ----
register struct super_block *sp;
! register dev_t dev;
! dev = (dev_t) rip->i_zone[0];
if (dev == ROOT_DEV) return(TRUE); /* inode is on root file system */
***************
*** 216,220 ****
/* Return the scale factor used for converting blocks to zones. */
register struct super_block *sp;
- extern struct super_block *get_super();
sp = get_super(ip->i_dev);
--- 211,214 ----
***************
*** 226,230 ****
* rw_super *
*===========================================================================*/
! PUBLIC rw_super(sp, rw_flag)
register struct super_block *sp; /* pointer to a superblock */
int rw_flag; /* READING or WRITING */
--- 220,224 ----
* rw_super *
*===========================================================================*/
! PUBLIC void rw_super(sp, rw_flag)
register struct super_block *sp; /* pointer to a superblock */
int rw_flag; /* READING or WRITING */
***************
*** 233,238 ****
register struct buf *bp;
! dev_nr dev;
! extern struct buf *get_block();
/* Check if this is a read or write, and do it. */
--- 227,231 ----
register struct buf *bp;
! dev_t dev;
/* Check if this is a read or write, and do it. */
***************
*** 239,243 ****
if (rw_flag == READING) {
dev = sp->s_dev; /* save device; it will be overwritten by copy*/
! bp = get_block(sp->s_dev, (block_nr) SUPER_BLOCK, NORMAL);
copy( (char *) sp, bp->b_data, SUPER_SIZE);
sp->s_dev = dev; /* restore device number */
--- 232,236 ----
if (rw_flag == READING) {
dev = sp->s_dev; /* save device; it will be overwritten by copy*/
! bp = get_block(sp->s_dev, SUPER_BLOCK, NORMAL);
copy( (char *) sp, bp->b_data, SUPER_SIZE);
sp->s_dev = dev; /* restore device number */
***************
*** 244,248 ****
} else {
/* On a write, it is not necessary to go read superblock from disk. */
! bp = get_block(sp->s_dev, (block_nr) SUPER_BLOCK, NO_READ);
copy(bp->b_data, (char *) sp, SUPER_SIZE);
bp->b_dirt = DIRTY;
--- 237,241 ----
} else {
/* On a write, it is not necessary to go read superblock from disk. */
! bp = get_block(sp->s_dev, SUPER_BLOCK, NO_READ);
copy(bp->b_data, (char *) sp, SUPER_SIZE);
bp->b_dirt = DIRTY;